package com.tinama.jedis01.demo;

import com.sun.org.apache.bcel.internal.generic.NEW;
import jdk.nashorn.internal.ir.IfNode;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author lgc
 * @createDate 2020/10/9 - 14:47
 */
public abstract class Demo {

    public static void main(String[] args){
//        ArrayList<Integer> a4 =  new ArrayList<Integer>(Arrays.asList(1,2,3,45,6));
//        a4.removeIf(a -> a % 2 == 0);
//        System.out.println(a4);

//        List<Integer> integers = Arrays.asList(1, 2, 3, 45, 6);
//        integers.removeIf(a -> a % 2 == 0);
//        System.out.println(integers);

          new ConcurrentHashMap<>();

//        a4 =  new ArrayList<Integer>();
//        a4.add("6");
//        Object o = a4.get(0);
//
//        ArrayList<? extends Number> arr3; // Number 是 Integer、Float的父类； ArrayList<Number> arr3只能引用 ArrayList<Number>
//        arr3 = new ArrayList<Integer>();
//        arr3 = new ArrayList<Float>();



//        System.out.println(("12"=="12"&&"12".equals("12")));
//
//        System.out.println("ab"=="ab");
//        System.out.println("12".equals("12"));

//        List<String> strings = Arrays.asList("a", "b", "c");
//         new HashMap();




      /*  int[] arr = {5,7,8,10,78,88,1};
        int[] sort = sort(arr);
        System.out.println(Arrays.toString(sort));*/
    }
    public static int[] sort(int... a){
        int temp;
        int count = 0;
        for (int i = 1; i < a.length; i++) {
            boolean isOrdered = true;
            for (int j = 0; j < a.length-i; j++) {
                if (a[j]>a[j+1]){
                     temp = a[j];
                     a[j] = a[j+1];
                     a[j+1] = temp;
                     count++;
                    isOrdered = false;
                }
            }
            if (isOrdered){
                System.out.println("执行了"+count+"次已经是有序的了，不必再继续了");
                break;
            }
        }
        return a;
    }
}
